
import couponApi from '../../api/coupon'
import * as types from '../../constants/ActionTypes'

//业务层次下拉框
const getBusinessLevelSelect = (businessLevelSelect) => ({
    type: types.GET_BUSINESS_LEVEL_SELECT,
    businessLevelSelect,
})

export const checkBusinessLevelSelect = (data) => dispatch => {     
    return couponApi.getBusinessLevelSelect(data,res => {
        dispatch(getBusinessLevelSelect(res));
    })    
}

//产品列表
const getProductList = (productList,productListTotal) => ({
    type: types.GET_PRODUCT_LIST,
    productList,
    productListTotal
})

export const checkProductList= (data) => dispatch => { 
    return couponApi.getProductList(data,res => {
        dispatch(getProductList(res.recordList,res.totalCount));
    })    
}
